<template>
  <div class="container">
    <div class="info">
      {{typeInfo[name]}}
    </div>
  </div>
</template>

<script>
  export default {
    name: 'Error',

    computed: {
      name() {
        return this.$route.query.name;
      },
    },

    watch: {},

    data() {
      return {
        typeInfo: {
          'page-not-found': '访问的页面不存在',
          'not-has-role': '无权限访问该页面',
        },
        timeNum: 5
      };
    },

    methods: {},

    mounted() {
      this.timer = setInterval(() => {
        if (this.timeNum > 0) {
          this.timeNum--
        } else {
          clearInterval(this.timer)
          let url = '/login/'
          if (self != top) {
            // 配置页面iframe
            top.location.replace(url)
          } else {
            location.replace(url)
          }
        }
      }, 1000)
    },
  };
</script>

<style scoped lang="scss">
  .container {
    width: 100vw;
    height: 100vh;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-top: 15vh;
    box-sizing: border-box;

    .info {
      margin-top: 10vh;
      font-size: 20px;
    }
  }
</style>
